import React, { Component } from 'react';
import './footer.scss'
import {  withRouter } from 'react-router-dom'
import { getApiIndexIcp } from "../../axios/api"
import { get } from '../../axios/localstorage';

class footer extends Component {

    state = {
        data:{}
    }

    componentDidMount(){

        getApiIndexIcp({
            type:get('type')?get('type'):0,
            content:get('city')?get('city'):get('mechanism')
        })
        .then( req =>{
            if(req.data.code === 1){
                let data = req.data.data;
                this.setState({
                    data
                })
            }
        }).catch( err =>{
            console.error(err);
        })
    }

    gotoTab=(type)=>{
   
        if(type === 1){
          this.props.history.push('/home');
        }else if(type === 2){
          this.props.history.push('/test');
        }else{
          this.props.history.push('/about');
        }
    }

    gotoPage=(page)=>{
        this.props.history.push(page);
    }


    render() {
        return (
            <div className="footer">
                <div className="fbox">
                    <div className="f2">
                        <p>Copyright © 2021 chuangxin.com All Rights</p>
                        <div className="fcen">
                            <img alt="" src="assets/imgs/jing.png" />
                            <p>{this.state.data.companyname} | {this.state.data.servecontent} <a target="_blank" rel="noopener noreferrer" href="https://beian.miit.gov.cn/">{this.state.data.recordnumber}</a></p>
                            
                        </div>
                        {/* <p>技术支持：南京友博网络科技有限公司</p> */}
                    </div>
                </div>
                
            </div>
        );
    }
}

export default withRouter(footer);